<?xml version="1.0" encoding="UTF-8"?>

<mule xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking" xmlns:jdbc-ee="http://www.mulesoft.org/schema/mule/ee/jdbc" xmlns:mulexml="http://www.mulesoft.org/schema/mule/xml" xmlns:http="http://www.mulesoft.org/schema/mule/http"
	xmlns:cxf="http://www.mulesoft.org/schema/mule/cxf" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"
	xmlns:spring="http://www.springframework.org/schema/beans" xmlns:json="http://www.mulesoft.org/schema/mule/json"
	xmlns:file="http://www.mulesoft.org/schema/mule/file" xmlns:scripting="http://www.mulesoft.org/schema/mule/scripting"
	xmlns:jms="http://www.mulesoft.org/schema/mule/jms" xmlns="http://www.mulesoft.org/schema/mule/core"
	version="EE-3.4.1"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd
http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd
http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd
http://www.mulesoft.org/schema/mule/cxf http://www.mulesoft.org/schema/mule/cxf/current/mule-cxf.xsd
http://www.mulesoft.org/schema/mule/jms http://www.mulesoft.org/schema/mule/jms/current/mule-jms.xsd
http://www.mulesoft.org/schema/mule/scripting http://www.mulesoft.org/schema/mule/scripting/current/mule-scripting.xsd
http://www.mulesoft.org/schema/mule/json http://www.mulesoft.org/schema/mule/json/current/mule-json.xsd
http://www.mulesoft.org/schema/mule/xml http://www.mulesoft.org/schema/mule/xml/current/mule-xml.xsd
http://www.mulesoft.org/schema/mule/ee/jdbc http://www.mulesoft.org/schema/mule/ee/jdbc/current/mule-jdbc-ee.xsd
http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">

<mulexml:namespace-manager>
    <mulexml:namespace prefix="a" uri="http://wgrus.com/Accounting"/>
</mulexml:namespace-manager>

	<jms:activemq-connector name="Active_MQ1"
		specification="1.1" brokerURL="tcp://localhost:61616"
		validateConnections="true" doc:name="Active MQ" />
	<flow name="CustomerUpdateToAccountingFlow1" doc:name="CustomerUpdateToAccountingFlow1">
		<jms:inbound-endpoint connector-ref="Active_MQ1"
			doc:name="JMS" queue="WGRUS.INCOMMING_CUSTOMER" />
        <set-variable variableName="originalPayload" value="#[message.payload]" doc:name="Variable"/>
			
			<http:outbound-endpoint exchange-pattern="request-response"   path="AccountingServices" method="POST" doc:name="ServiceClient" host="localhost" port="30000">
		<cxf:jaxws-client operation="UpdateCustomer"
			serviceClass="dk.eal.kbr.si.wgrus.accounting.AccountingServices"
			doc:name="SOAP" 
			port="BasicHttpBinding_AccountingServices"/>
			</http:outbound-endpoint>
        <expression-filter evaluator="groovy" expression="!payload.isSuccesfull" doc:name="Expression"/>
        
        <set-payload value="#[originalPayload]" doc:name="Set Payload"/>
        <jms:outbound-endpoint queue="WGRUS.INVALID_CUSTOMER" connector-ref="Active_MQ" doc:name="JMS"/>

	</flow>

</mule>
